﻿using BCCommon;
using BCDto.Sim.Admin.Admin;
using BCDto.Sim.Company.Department;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace BCService.Sim.Company.Department
{
    /// <summary>
    /// 企业部门管理服务接口
    /// </summary>
    public interface IDepartmentService
    {
        /// <summary>
        /// 新增部门
        /// </summary>
        /// <param name="adminDto">当前登录人</param>
        /// <param name="dto">部门信息</param>
        /// <returns></returns>
        DepartmentDto Add(AdminDto adminDto, DepartmentRequestDto dto);

        /// <summary>
        /// 修改部门信息
        /// </summary>
        /// <param name="id">部门Id</param>
        /// <param name="adminDto">当前登录人</param>
        /// <param name="dto">部门信息</param>
        /// <returns></returns>
        DepartmentDto Update(int id, AdminDto adminDto, DepartmentRequestDto dto);
        /// <summary>
        /// 删除部门
        /// </summary>
        /// <param name="departmentId">部门Id</param>
        /// <returns></returns>
        bool Delete(int departmentId);
        /// <summary>
        /// 通过id查询部门信息
        /// </summary>
        /// <param name="departmentId">部门Id</param>
        /// <returns></returns>
        DepartmentDto Get(int departmentId);
        /// <summary>
        /// 获取部门列表
        /// </summary>
        /// <param name="companyId">公司Id</param>
        /// <param name="departmentName">部门名称</param>
		/// <param name="start">开始时间</param>
		/// <param name="end">结束时间</param>
        /// <param name="sortName">排序字段</param>
        /// <param name="ascending">升序</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页数据条数</param>
        /// <returns></returns>
        PageableList<DepartmentDto> Query(int companyId, string departmentName, DateTime? start, DateTime? end, string sortName, bool? ascending, int pageIndex, int pageSize);       
        /// <summary>
        /// 查询子级部门
        /// </summary>
        /// <param name="departmentId">部门Id</param>
        /// <param name="companyId">公司Id</param>
        /// <returns></returns>
        IEnumerable<DepartmentDto> Children(int departmentId, int companyId);
        /// <summary>
        /// 获取子级部门
        /// </summary>
        /// <param name="departmentId">部门Id</param>
        /// <returns></returns>
        IEnumerable<DepartmentDto> Children(int departmentId);
        /// <summary>
        /// 获取跟部门列表
        /// </summary>
        /// <param name="companyId">公司配置Id</param>
        /// <returns></returns>
        IEnumerable<DepartmentDto> Root(int companyId);
        /// <summary>
        /// 获取部门及所有子级部门树型列表
        /// </summary>
        /// <param name="companyId">公司Id</param>
        /// <param name="departmentId">部门Id</param>
        /// <returns></returns>
        List<object> ChildrenTree(int companyId, int? departmentId);
        /// <summary>
        /// 获取公司、部门及所有子级部门树型列表
        /// </summary>
        /// <param name="levelType">级别类型</param>
        /// <param name="selectable">允许选中</param>
        /// <param name="allowAcrossCompany">允许跨公司</param>
        /// <param name="companyId">当前登录人所在公司Id</param>
        /// <returns></returns>
        List<object> CompanyDepartmentPersonTree(string levelType, bool selectable, bool allowAcrossCompany, int companyId);
        /// <summary>
        /// 获取公司、部门及所有子级部门树型列表
        /// </summary>
        /// <param name="levelType">级别类型</param>
        /// <param name="selectable">允许选中</param>
        /// <param name="companyId">当前登录人所在公司Id</param>
        /// <param name="departmentId">当前登录人所在部门Id</param>
        /// <returns></returns>
        List<object> CompanyDepartmentPersonTree(string levelType, bool selectable, int companyId, int departmentId);
        /// <summary>
        /// 查询全部
        /// </summary>
        /// <param name="companyId">公司Id</param>
        /// <returns></returns>
        List<DepartmentDto> GetList(int companyId);

        /// <summary>
        /// 部门负责人列表
        /// </summary>
        /// <param name="companyId">公司Id</param>
        /// <param name="departmentId">部门Id</param>
        /// <returns></returns>
        List<DepartmentPrincipalDto> StaffList(int companyId, int? departmentId);
        /// <summary>
        /// 更新员工数量
        /// </summary>
        /// <param name="departmentId">部门Id</param>
        /// <returns></returns>
        bool UpdateStaffCount(int departmentId);
        /// <summary>
        /// 设置部门负责人信息
        /// </summary>
        /// <param name="departmentPrincipalPutDto">部门负责人信息</param>
        /// <returns></returns>
        bool SetPrincipalInfo(DepartmentPrincipalPutDto departmentPrincipalPutDto);
        /// <summary>
        /// 移除部门负责人信息
        /// </summary>
        /// <param name="adminDto">当前登录人</param>
        /// <param name="departmentPrincipalPutDto">部门负责人信息</param>
        /// <returns></returns>
        bool RemovePrincipalInfo(AdminDto adminDto, DepartmentPrincipalPutDto departmentPrincipalPutDto);
    }
}
